package com.yinhe.music.yhmusic.singer;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yinhe.music.yhmusic.R;
import com.yinhe.music.yhmusic.base.BaseFragment;
import com.yinhe.music.yhmusic.constants.IConstants;


/**
 * 歌手详情界面
 *
 * @author hasee
 * @date 2017/3/3
 */

public class SingerDetailFragment extends BaseFragment {

    String mDetail;

    TextView title;

    int type;

    public static SingerDetailFragment newInstance(String detail, int type) {

        Bundle args = new Bundle();
        args.putString("detail", detail);
        args.putInt("type", type);

        SingerDetailFragment fragment = new SingerDetailFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.singer_detail, container, false);
        if (getArguments() != null) {
            mDetail = getArguments().getString("detail");
            type = getArguments().getInt("type", IConstants.SINGER_DETAIL);
        }
        TextView content = view.findViewById(R.id.content);
        title = view.findViewById(R.id.title);

        if (type == IConstants.SINGER_DETAIL) {
            title.setText("歌手简介");
        } else if (type == IConstants.INSTRUMENT_DETAIL){
            title.setText("乐器简介");
        } else {
            title.setText("个人简介");
        }
        if (mDetail != null && !mDetail.isEmpty()) {
            content.setText(mDetail);
        } else {
            content.setText("暂无");
        }
        return view;
    }
}
